package com.zhiyou.servlet;

import com.zhiyou.service.UserListService;
import com.zhiyou.service.impl.UserLisetServiceImp;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class UserDeleteServlet extends HttpServlet {
    private UserListService uLS = new UserLisetServiceImp();

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("删除开始执行");
        String idStr = req.getParameter("uid");
        System.out.println(idStr);
        int uid=Integer.parseInt(idStr);
        uLS.deleteById(uid);
        resp.sendRedirect(req.getContextPath()+"/user/list?pageNo="+req.getParameter("pageNo"));
    }
}
